package cn.bd13.xinapp.utils;


import cn.bd13.xinapp.model.dto.ReturnResult;

public class ReturnUtils {

    public static ReturnResult returnSuccess(){
        ReturnResult result=new ReturnResult();
        result.setCode("200");
        return result;
    }

    public static ReturnResult returnSuccess(String msg){
        ReturnResult result=new ReturnResult();
        result.setCode("200");
        result.setMsg(msg);
        return result;
    }

    public static ReturnResult returnSuccessWithData(Object data){
        ReturnResult result=new ReturnResult();
        result.setCode("200");
        result.setData(data);
        return result;
    }

    public static ReturnResult returnSuccessWithData(Object data,String msg){
        ReturnResult result=new ReturnResult();
        result.setCode("200");
        result.setData(data);
        result.setMsg(msg);
        return result;
    }

    public static ReturnResult returnFailed(String code){
        ReturnResult result=new ReturnResult();
        result.setCode(code);
        return result;
    }

    public static ReturnResult returnFailed(String code,String msg){
        ReturnResult result=new ReturnResult();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

    public static ReturnResult returnFailedWithData(String code,String msg,Object data){
        ReturnResult result=new ReturnResult();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

}
